package ming.model.type;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang.StringUtils;

@SuppressWarnings("serial")
@Entity
@Table(name = "t_tobacco_warnstate")
public class Warnstate implements java.io.Serializable {

	// Fields

	private String id;
	private String warnState;
	private Set<Warnlog> warnlogs = new HashSet<Warnlog>(0);


	// Property accessors
	@Id
	@Column(name = "vcID", unique = true, nullable = false, length = 36)
	public String getId() {
		if (!StringUtils.isBlank(this.id)) {
			return this.id;
		}
		return UUID.randomUUID().toString();
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "vcWarnState", length = 50)
	public String getWarnState() {
		return this.warnState;
	}

	public void setWarnState(String warnState) {
		this.warnState = warnState;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "warnstate")
	public Set<Warnlog> getWarnlogs() {
		return this.warnlogs;
	}

	public void setWarnlogs(Set<Warnlog> warnlogs) {
		this.warnlogs = warnlogs;
	}

}